package com.gaoyi.crm.control.dialog;

import android.content.Context;
import android.view.View;
import android.view.WindowManager;

import com.gaoyi.crm.R;
import com.gaoyi.crm.databinding.DialogComboPicBinding;

public class ComboPicDialog extends BaseFragmentDialog<DialogComboPicBinding> implements View.OnClickListener {

    private OnClickListener mOnClickListener;

    public static ComboPicDialog newInstance(Context context){
        return new ComboPicDialog(context);
    }

    public ComboPicDialog(Context context) {
        super(context);
    }

    public ComboPicDialog setClickListener(OnClickListener onClickListener) {
        this.mOnClickListener = onClickListener;
        return this;
    }

    @Override
    protected void initView() {
        mBinding.itemCamera.setOnClickListener(this);
        mBinding.itemFile.setOnClickListener(this);
        mBinding.itemCancel.setOnClickListener(this);
    }

    @Override
    protected DialogComboPicBinding getViewBinding() {
        return DialogComboPicBinding.inflate(getLayoutInflater());
    }

    @Override
    protected String getShowTag() {
        return BOTTOM;
    }

    @Override
    protected int getWidth() {
        return WindowManager.LayoutParams.MATCH_PARENT;
    }

    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (id == R.id.item_camera) {
            mOnClickListener.camera();
        }else if (id == R.id.item_file) {
            mOnClickListener.file();
        }else if (id == R.id.item_cancel) {
            mOnClickListener.cancel();
        }
    }

    public interface OnClickListener{
        void camera();
        void file();
        void cancel();
    }
}
